home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 November: Tool Chest / Dev.CD Nov 94.toast / Sample Code / Newton Sample Code 1.2 / System Messages / Clock-2 / Clock.text < prev    next >
Encoding:
Text File  |  1994-02-28  |  1.9 KB  |  79 lines  |  [TEXT/MPS ]

  1.  
  2. // ---- End Project Data ----
  3.  
  4.  
  5. // ---- File Clock.t ----
  6.  
  7. // Before Script for "_view000"
  8. // Copyright © 1993, 1994 by Apple Computer, Inc.  All rights reserved.
  9.  
  10. _view000 :=
  11.    {viewBounds: {left: 0, top: 0, right: 142, bottom: 88},
  12.     viewJustify: 80,
  13.     _proto: protoFloatNGo
  14.    };
  15.  
  16.  
  17. // Before Script for "_view001"
  18. // Copyright © 1993, 1994 by Apple Computer, Inc.  All rights reserved.
  19.  
  20. _view001 := /* child of _view000 */
  21.    {text: "",
  22.     viewBounds: {left: 0, top: 0, right: 0, bottom: 20},
  23.     viewIdleScript:
  24.       DefConst('kMyTimeSpec, GetDateStringSpec([[kElementHour, kFormatNumeric],
  25.                                                [kElementMinute, kFormatNumeric]]));
  26.       
  27.       
  28.       func()
  29.       begin
  30.          // hack out a value for seconds, since Time()
  31.          // only returns minutes.
  32.          local seconds := TimeInSeconds() mod 60 ;
  33.          local secString := if seconds < 10 then "0" & seconds else NumberStr(seconds) ;
  34.       
  35.          // change my text
  36.          SetValue(self, 'text, TimeStr(Time(), kMyTimeSpec) & ":" & secString) ;
  37.       
  38.          // call me again in 1 second
  39.          1000;
  40.       end,
  41.     viewSetupDoneScript:
  42.       func()
  43.       begin
  44.          // setup to call the viewIdleScript after 1 second,
  45.          // and call the viewIdleScript to get an initial value.
  46.          :SetupIdle(:viewIdleScript());
  47.       end,
  48.     viewFont: fancyFont18+tsBold,
  49.     viewJustify: 8388726,
  50.     viewSetupFormScript:
  51.       func()
  52.       begin
  53.          viewBounds := Clone(viewBounds) ;
  54.          viewbounds.bottom := fontHeight(viewFont);
  55.       end,
  56.     _proto: protoStaticText
  57.    };
  58.  
  59.  
  60.  
  61.  
  62. // Before Script for "_view002"
  63. // Copyright © 1993, 1994 by Apple Computer, Inc.  All rights reserved.
  64.  
  65. _view002 := /* child of _view000 */
  66.    {title: "Clock!",
  67.     viewBounds: {left: -4, top: 8, right: 68, bottom: 24},
  68.     _proto: protoTitle
  69.    };
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76.  
  77. // ---- Beginning of section for non used Layout files ----
  78.  
  79. // End of output